package com.itheima.chapter04.arraylist;

import com.itheima.domian.Student;
/*
    存储学生对象并遍历
 */
import java.util.ArrayList;

public class demo3 {
    public static void main(String[] args) {
        ArrayList<Student> array =new ArrayList<>();
        Student s1 = new Student("李三",23);
        Student s2 = new Student("王四",24);
        Student s3 = new Student("王二",25);
        array.add(s1);
        array.add(s2);
        array.add(s3);
        for (int i = 0; i < array.size(); i++) {
            Student s = array.get(i);
            System.out.println(s);
            System.out.println(s.getName()+"、、、"+s.getAge());
        }
    }
}
